package test.y2020;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.cron.CronUtil;
import cn.hutool.cron.task.Task;

/**
 * Created By  醉美柳舞之众星捧月
 *
 * @author songx
 * @date 2020/3/6 15:07
 */
public class March1 {
    public static void main(String[] args) {
        first();
    }

    private static void first() {
        CronUtil.schedule("*/2 * * * * *", new Task() {
            @Override
            public void execute() {
                Console.error(DateUtil.now());
                Console.log(second());
                Console.error(DateUtil.now());
            }
        });
        CronUtil.setMatchSecond(true);
        CronUtil.start();
    }

    private static String second() {
        for (int i = 0; i < 100; i++) {
            if (i >= 99) {
                return "啦啦啦";
            } else {
                Console.error(i);
            }
        }
        return "ERRor:  ==>>>>  ";
    }
}
